home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15751 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: news.ruhr-uni-bochum.de!usenet
  2. From: Karsten Soete <Karsten.Soete@rz.ruhr-uni-bochum.de>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: strncpy() ?
  5. Date: 21 Apr 1996 16:42:33 GMT
  6. Organization: Ruhr-Universitaet Bochum, Rechenzentrum
  7. Message-ID: <4ldohp$6e7@sun168.rz.ruhr-uni-bochum.de>
  8. NNTP-Posting-Host: dialslip-31.rz.ruhr-uni-bochum.de
  9.  
  10. lonewolf@athena.compulink.gr (Costas Vlassis) schreibt:
  11. >     Well I have this question, let's say we have the following :
  12. > char alfa[40] = "1123";
  13. > char beta[20];
  14. > char gama[20];
  15. > With strncpy(beta,alfa,2) beta = "11" that's fine but HOW can I make 
  16. > gama = "23" that is the last 2 characters of alfa or even "3" the last 
  17. > character... Is there a function that takes start and end as strings ?
  18. > what I want is something like :
  19. > strncpy2 (beta,alfa,2,4);
  20. >     is this possible ?
  21. >     Costas Vlassis
  22. >     lonewolf@compulink.gr
  23.  
  24. Hello!
  25.  
  26. There is no such function implemented at the time, but it's
  27. possible.
  28. Try
  29.   for(int i=0;i<2;i++) beta[i]=alpha[i+2];
  30.  
  31.   Greetings, AnimalOnLine.
  32.